<template>
  <div class="home" style="width: 100%;height:100%;">
    <!-- <Dingbu :nameTitle="PageName"></Dingbu> -->
    <div class="content">
         <Form :label-width="140" ref="formItem" :model="formItem">
              <FormItem label="新客下单立减(元)">
                  <Input v-model="formItem.red"></Input>
                  <p style="text-align:left;color:orange;font-size:14px;">该活动只适用于首次下单的用户</p>
              </FormItem>
              <FormItem>
                  <Button type="success" @click="editRed">保存设置</Button>
              </FormItem>
          </Form>
    </div>
  </div>
</template>
<script>
import Dingbu from "../header/dingbu.vue";
import { mapGetters, mapMutations, mapActions } from "vuex";
import Base from "../../common/Base";
import { shop_info, edit_red } from "../../api/store/store.js";
export default {
    mixins:[Base],
  data() {
    return {
      PageName: "新客立减",
      formItem: {
        red: ''
      },
    };
  },
  mounted() {
  },
  components: {
    Dingbu
  },
  methods: {
    getData() {
      shop_info({}).then(res => {
        this.formItem.red = res.data.red;
      });
    },
    editRed() {
      edit_red({red: this.formItem.red,token: 1}).then(res => {
        this.getData();
        this.$Message.success("修改成功！");
      })
    }
  },
  created() {
    this.getData();
  }
};
</script>
<style lang="scss" scoped>
@import "../../css/common.scss";
.content {
  width: 95%;
  margin: 20px auto;
}
</style>

